import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/modules/package/help/package_help.dart';
import 'package:honeypotflutter/public/views/public_refresh.dart';
import 'package:honeypotflutter/publicBussine/view/bussine_button.dart';
import '../package_list/view.dart';
import 'logic.dart';

class PackageRetentionListPage extends StatefulWidget {
  final HLRefreshController? refreshController;
  final int? deviceId;
  final Function()? recallPackageAction;
  final Function()? modifyPhoneAction;
  const PackageRetentionListPage({
    Key? key,
    this.deviceId,
    this.refreshController,
    this.recallPackageAction,
    this.modifyPhoneAction,
  }) : super(key: key);

  @override
  State<PackageRetentionListPage> createState() => _PackageRetentionListPageState();
}

class _PackageRetentionListPageState extends State<PackageRetentionListPage> {
  final PackageRetentionListLogic logic = Get.put(PackageRetentionListLogic());

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    logic.getRenewalInfo(widget.deviceId);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PackageListPage(
        type: PackageType.retentionPackage,
        refreshController: widget.refreshController,
        recallPackageAction: widget.recallPackageAction,
        modifyPhoneAction: widget.modifyPhoneAction,
      ),
      bottomSheet: MGButton(
        title: "续费",
        padding: EdgeInsets.only(left: 30, right: 30, bottom: 30, top: 15),
        buttonAction: () {
          logic.quickRenewal(widget.deviceId);
        },
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<PackageRetentionListLogic>();
    super.dispose();
  }
}
